\chapter{Filtering} \label{ch:filtering}

The contents of this chapter are informative only.

Filtering provides a mechanism to control whether the encoder should produce trace.  For example,
it may be desirable to trace:

\begin{itemize}
  \item When the instruction address is within a particular range;
  \item Starting from one instruction address and continuing until a second instruction address;
  \item For one or more specified privilege levels;
  \item For a particular context or range of contexts;
  \item Exception and/or interrupt handlers for specified exception causes or with particular \textbf{tval} values;
  \item Based on values applied to the \textbf{impdef} or \textbf{trigger} signals;
  \item For a fixed period of time
  \item etc.
\end{itemize}

How this is accomplished is implementation specific.  

One suggested implementation provides: 

\begin{itemize}
  \item Comparators offering a range of arithmetic options (<, >, =, !=, etc) for \textbf{iaddress}, 
    \textbf{context} and \textbf{tval} inputs;
  \item Multiple choice selection for \textbf{priv} and \textbf{cause} inputs;
  \item Masked matching for \textbf{interrupt} and \textbf{impdef} inputs;
  \item The ability to enable tracing when \textbf{trigger[0]} is asserted, and continue tracing 
    until \textbf{trigger[0]} is asserted (see Section~\ref{sec:trigger}).
\end{itemize}


